package com.sh.intermediate_control;

import android.os.Bundle;
import android.view.View;
import android.widget.RadioGroup;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class RadioHorizontalActivity extends AppCompatActivity implements RadioGroup.OnCheckedChangeListener {

    private TextView tvRres;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_radio_horizontal);

        RadioGroup rg_gender = findViewById(R.id.rg_gender);

        tvRres = findViewById(R.id.tv_Rres);


        rg_gender.setOnCheckedChangeListener(this);
    }

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        if (checkedId== R.id.rb_man){
            tvRres.setText("你选择的男孩");
        }
        if (checkedId==R.id.rb_female){
            tvRres.setText("你选择的女孩");
        }
    }
}